<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
var singleNumber = function(nums) {
    let map = new Map()
    for( var i=0 ; i<nums.length ; i++ ){
        let count = map.get(nums[i]) || 0
        map.set(nums[i],count+1)
    }
    for( var i=0 ; i<nums.length ; i++ ){
        if( map.get(nums[i]) === 1 ){
            return nums[i]
        }
    }
};

var nums = [0,1,0,1,0,1,99]
console.log(singleNumber(nums))
    </script>
</body>
</html>